file chooser: Reload current dir when switching from search mode
authorMatthias Clasen <mclasen@redhat.com>
Tue, 16 Feb 2016 03:06:17 +0000 (22:06 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 16 Feb 2016 03:06:17 +0000 (22:06 -0500)
The need for this was pointed out by Evangelos Foutras in
https://bugzilla.gnome.org/show_bug.cgi?id=761757

gtk/gtkfilechooserwidget.c

index 1364def2a5add3a044c1d1bf63201a054a50a2f2..c93c9a15655864d47e10c453d534bfcb9b27ef7f 100644 (file)
@@ -593,6 +593,7 @@ static void     clear_model_cache            (GtkFileChooserWidget *impl,
                                               gint                  column);
 static void     set_model_filter             (GtkFileChooserWidget *impl,
                                               GtkFileFilter        *filter);
+static void     switch_to_home_dir           (GtkFileChooserWidget *impl);
 
 \f
 
@@ -2563,10 +2564,18 @@ static void
 location_entry_changed_cb (GtkEditable          *editable,
                            GtkFileChooserWidget *impl)
 {
-  if (impl->priv->operation_mode == OPERATION_MODE_SEARCH)
-    operation_mode_set (impl, OPERATION_MODE_BROWSE);
+  GtkFileChooserWidgetPrivate *priv = impl->priv;
+
+  if (priv->operation_mode == OPERATION_MODE_SEARCH)
+    {
+      operation_mode_set (impl, OPERATION_MODE_BROWSE);
+      if (priv->current_folder)
+        change_folder_and_display_error (impl, priv->current_folder, FALSE);
+      else
+        switch_to_home_dir (impl);
+    }
 
-  if (impl->priv->action != GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+  if (priv->action != GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
     reset_location_timeout (impl);
 }